class Fraction:
    def __init__(self,a,b):
        if b<0:
            a*=-1
            b*=-1
        self.__a=a
        self.__b=b
        self.__reduce()

    def __reduce(self):
        g = self.__gcd()
        if g != 1:
            self.__a //= g
            self.__b //= g

    def __gcd(self):
        n = self.__a
        d = self.__b
        if n == 0:
            return d
        if n < 0:
            n = -n
        while (True):
            r = n % d
            if r == 0:
                break
            n = d
            d = r
        return d
    def to_float(self):
        return float(self.__a/self.__b)
    def plus(self,r):
        return Fraction(self.__a*r.__b+r.__a*self.__b,self.__b*r.__b)
    def multiply(self,r):
        return Fraction(self.__a*r.__a,self.__b*r.__b)
    def print_fraction(self):
        if self.__a % self.__b==0:
            print(int(self.__a/self.__b))
        else:
            print(f"{self.__a}/{self.__b}")